package com.remeberword;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by arch on 2017/12/10.
 */

public class MyDatabaseHelper extends SQLiteOpenHelper {

    public static final String CREATE_WORDPAIR = "create table wordPair (" +
            "english text primary key," +
            "chinese text," +
            "frequency integer)";

    private Context context;

    public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory, SQLiteVersion.VERSION);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_WORDPAIR);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        sqLiteDatabase.execSQL("drop table if exists wordPair");
        onCreate(sqLiteDatabase);
    }
}

